package com.zhy.springcloud.controller;

import com.sun.xml.internal.ws.client.sei.ValueSetter;
import com.zhy.springcloud.enetities.CommonResult;
import com.zhy.springcloud.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author zhy
 * @Description
 * @ClassName StorageController
 * @Date 2021/1/7 17:52
 **/
@RestController
@Slf4j
public class StorageController {

    @Resource
    private StorageService storageService;

    @RequestMapping(value = "/storage/decrease")
    public CommonResult decrease(@RequestParam("productId")Long productId,
                                 @RequestParam("count") Integer count
                                 ){
        storageService.decrease(productId,count);
        return new CommonResult(200,"扣款库存成功");
    }

}
